--和气生财
local heqishengcai = fk.CreateSkill {
    name = "mcdh_heqishengcai",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

heqishengcai:addEffect(fk.CardUseFinished,{
    can_trigger = function(self, event, target, player, data)
        if player:hasSkill(self) and player:getMark("mcdh_charge") >= 2 and data.responseToEvent and data.responseToEvent.card.type == Card.TypeBasic then
            return data.from and data.responseToEvent.from and data.from ~= data.responseToEvent.from
        end
    end,
    on_cost = function (self, event, target, player, data)
        local room = player.room
        local from = data.from
        local to = data.responseToEvent.from
        if room:getCardArea(data.responseToEvent.card) == Card.Processing then
            return room:askForSkillInvoke(player,self.name,nil,"#mcdh_heqishengcai_card:"..from..":"..to..":"..data.responseToEvent.card.name)
        else
            return room:askForSkillInvoke(player,self.name,nil,"#mcdh_heqishengcai_nocard:"..from..":"..to)
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        lib.LoseCharge(player,player,2,self.name)
        local from = data.from
        local to = data.responseToEvent.from
        if room:getCardArea(data.responseToEvent.card) == Card.Processing and player:isAlive() then
            room:obtainCard(player,data.responseToEvent.card,true,fk.ReasonJustMove,player.id,self.name)
        end
        if from:isAlive() then
            from:drawCards(1,self.name)
        end
        if to:isAlive() then
            to:drawCards(1,self.name)
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_heqishengcai"] = "合利",
    [":mcdh_heqishengcai"] = "『和气生财』<br>蓄力技(2)，当一名角色使用牌响应另一名角色的基本牌后，你可以获得被响应的牌并令双方各摸一张牌。",
    ["#mcdh_heqishengcai_card"] = "和气生财：你可以获得【%arg】并令 %src 和 %dest 各摸一张牌",
    ["#mcdh_heqishengcai_nocard"] = "和气生财：你可以令 %src 和 %dest 各摸一张牌",
}

return heqishengcai